#include<cstdio>
using namespace std;
int main()
{
	int x, y, j, t;
	scanf("%d %d", &x, &y);
	for (j = 0; j <= x; j++)
	{
		if ((x - j) == (y - j * 2) / 4)
		{
			printf("%d %d", j, (x - j));
			break;
		}
	}
	return 0;
}
